package com.hs.homework_01.config;

import com.hs.homework_01.handler.MyHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName WebConfig
 * @Description TODO
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Bean
    HandlerInterceptor getHandler(){
        return new MyHandler();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(getHandler())
                .addPathPatterns("/**")
                .excludePathPatterns("/users/**");
    }
}
